(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.3' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[      5880,        171]
NotebookOptionsPosition[      5222,        151]
NotebookOutlinePosition[      5610,        168]
CellTagsIndexPosition[      5567,        165]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[{
 RowBox[{
  RowBox[{"Remove", "[", "\"\<Global`*\>\"", "]"}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"Clear", "[", "\"\<`*\>\"", "]"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"zs", "=", 
   RowBox[{"h0", "*", 
    RowBox[{"Exp", "[", 
     RowBox[{
      RowBox[{"-", 
       RowBox[{"r", "^", "2"}]}], "/", 
      RowBox[{"d", "^", "2"}]}], "]"}]}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"Simplify", "[", 
  RowBox[{"D", "[", 
   RowBox[{"zs", ",", "r"}], "]"}], "]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"r", "=", 
   RowBox[{
    RowBox[{"aref", "/", "X"}], "*", 
    RowBox[{"ArcCos", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"Sin", "[", "latc", "]"}], "*", 
       RowBox[{"Sin", "[", "lat", "]"}]}], "+", 
      RowBox[{
       RowBox[{"Cos", "[", "latc", "]"}], "*", 
       RowBox[{"Cos", "[", "lat", "]"}], "*", 
       RowBox[{"Cos", "[", 
        RowBox[{"lon", "-", "lonc"}], "]"}]}]}], "]"}]}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{"Simplify", "[", 
  RowBox[{"D", "[", 
   RowBox[{"r", ",", "lon"}], "]"}], "]"}], "\[IndentingNewLine]", 
 RowBox[{"Simplify", "[", 
  RowBox[{"D", "[", 
   RowBox[{"r", ",", "lat"}], "]"}], "]"}], "\[IndentingNewLine]"}], "Input",
 CellChangeTimes->{{3.8393858249762216`*^9, 3.8393860302855377`*^9}, {
   3.839386064287538*^9, 3.839386074204544*^9}, {3.839386188840563*^9, 
   3.8393862035785694`*^9}, {3.8393862372905474`*^9, 3.839386237733536*^9}, {
   3.8393864470167494`*^9, 3.8393864678707495`*^9}, {3.83938838617862*^9, 
   3.839388432506592*^9}, {3.8393908323040123`*^9, 3.8393908384580135`*^9}, 
   3.8396687600959587`*^9},
 CellLabel->"In[1]:=",ExpressionUUID->"4fdfada4-8705-4a79-92ee-142f7e4632df"],

Cell[BoxData[
 RowBox[{"-", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"(", 
     RowBox[{"2", "*", "h0", "*", "r"}], ")"}], "/", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"E", "^", 
       RowBox[{"(", 
        RowBox[{
         RowBox[{"r", "^", "2"}], "/", 
         RowBox[{"d", "^", "2"}]}], ")"}]}], "*", 
      RowBox[{"d", "^", "2"}]}], ")"}]}], ")"}]}]], "Output",
 CellChangeTimes->{
  3.839386317493789*^9, {3.839386453720749*^9, 3.839386470229753*^9}, 
   3.8393868588020086`*^9, {3.8393883889495955`*^9, 3.839388402082629*^9}, 
   3.8393884340605993`*^9, 3.8394257576290035`*^9, {3.839668762127251*^9, 
   3.83966877167484*^9}},
 FormatType->"InputForm",
 CellLabel->"Out[4]=",ExpressionUUID->"f0be9145-44fa-4076-972e-9966fcf539fa"],

Cell[BoxData[
 FractionBox[
  RowBox[{"aref", " ", 
   RowBox[{"Cos", "[", "lat", "]"}], " ", 
   RowBox[{"Cos", "[", "latc", "]"}], " ", 
   RowBox[{"Sin", "[", 
    RowBox[{"lon", "-", "lonc"}], "]"}]}], 
  RowBox[{"X", " ", 
   SqrtBox[
    RowBox[{"1", "-", 
     SuperscriptBox[
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"Cos", "[", "lat", "]"}], " ", 
         RowBox[{"Cos", "[", "latc", "]"}], " ", 
         RowBox[{"Cos", "[", 
          RowBox[{"lon", "-", "lonc"}], "]"}]}], "+", 
        RowBox[{
         RowBox[{"Sin", "[", "lat", "]"}], " ", 
         RowBox[{"Sin", "[", "latc", "]"}]}]}], ")"}], "2"]}]]}]]], "Output",
 CellChangeTimes->{
  3.839386317493789*^9, {3.839386453720749*^9, 3.839386470229753*^9}, 
   3.8393868588020086`*^9, {3.8393883889495955`*^9, 3.839388402082629*^9}, 
   3.8393884340605993`*^9, 3.8394257576290035`*^9, 3.83966876239295*^9},
 CellLabel->"Out[6]=",ExpressionUUID->"27437d6f-8ba6-4c11-a9c7-df2862073c13"],

Cell[BoxData[
 FractionBox[
  RowBox[{"aref", " ", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{
      RowBox[{"Cos", "[", "latc", "]"}], " ", 
      RowBox[{"Cos", "[", 
       RowBox[{"lon", "-", "lonc"}], "]"}], " ", 
      RowBox[{"Sin", "[", "lat", "]"}]}], "-", 
     RowBox[{
      RowBox[{"Cos", "[", "lat", "]"}], " ", 
      RowBox[{"Sin", "[", "latc", "]"}]}]}], ")"}]}], 
  RowBox[{"X", " ", 
   SqrtBox[
    RowBox[{"1", "-", 
     SuperscriptBox[
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"Cos", "[", "lat", "]"}], " ", 
         RowBox[{"Cos", "[", "latc", "]"}], " ", 
         RowBox[{"Cos", "[", 
          RowBox[{"lon", "-", "lonc"}], "]"}]}], "+", 
        RowBox[{
         RowBox[{"Sin", "[", "lat", "]"}], " ", 
         RowBox[{"Sin", "[", "latc", "]"}]}]}], ")"}], "2"]}]]}]]], "Output",
 CellChangeTimes->{
  3.839386317493789*^9, {3.839386453720749*^9, 3.839386470229753*^9}, 
   3.8393868588020086`*^9, {3.8393883889495955`*^9, 3.839388402082629*^9}, 
   3.8393884340605993`*^9, 3.8394257576290035`*^9, 3.839668762461197*^9},
 CellLabel->"Out[7]=",ExpressionUUID->"57aab00e-ce3a-46e6-9403-e771a952761b"]
}, Open  ]]
},
WindowSize->{1520, 805},
WindowMargins->{{Automatic, 476}, {89, Automatic}},
Magnification:>1.3 Inherited,
FrontEndVersion->"11.3 for Microsoft Windows (64-bit) (2018\:5e743\:670828\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[580, 22, 1728, 44, 367, "Input",ExpressionUUID->"4fdfada4-8705-4a79-92ee-142f7e4632df"],
Cell[2311, 68, 748, 20, 75, "Output",ExpressionUUID->"f0be9145-44fa-4076-972e-9966fcf539fa"],
Cell[3062, 90, 982, 25, 86, "Output",ExpressionUUID->"27437d6f-8ba6-4c11-a9c7-df2862073c13"],
Cell[4047, 117, 1159, 31, 86, "Output",ExpressionUUID->"57aab00e-ce3a-46e6-9403-e771a952761b"]
}, Open  ]]
}
]
*)

